﻿using System;
using System.Runtime.Serialization;
using System.Windows.Media.Media3D;

namespace GameBoard
{
    [DataContract]
    [KnownType(typeof(ArrowVisualFactory))]
    [KnownType(typeof(ConeVisualFactory))]
    [KnownType(typeof(GridVisualFactory))]
    [KnownType(typeof(InfoTextVisualFactory))]
    [KnownType(typeof(MapExtensionVisualFactory))]
    [KnownType(typeof(ObjectVisualFactory))]
    [KnownType(typeof(PictureVisualFactory))]
    [KnownType(typeof(SphereVisualFactory))]
    [KnownType(typeof(TubeVisualFactory))]
    [KnownType(typeof(CubeVisualFactory))]
    public abstract class BaseVisualFactory
    {
        public BaseVisualFactory(BaseVisualData theData)
        {
            _visualID = Guid.NewGuid();
            VisualData = theData;
        }

        [DataMember]
        private BaseVisualData _visualData;

        public BaseVisualData VisualData
        {
            get { return _visualData; }
            set
            {
                _visualData = value;
                _visualData.FactoryID = FactoryVisualID;
            }
        }

        public abstract ModelVisual3D MakeVisual();

        [DataMember]
        private Guid _visualID;

        public Guid FactoryVisualID
        {
            get { return _visualID; }
            protected set { _visualID = value; }
        }
    }
}